<template>
  <div>
       <div class="books-item" v-for="item in Books" :key="item.bookId">
         <div class="image">
              <a :href="item.link">
                  <img src="../assets/timg.jpg" alt="">
                </a>
          </div>
          <div class="words">
              <h1 class="title"><a href="">{{item.bookName}}</a></h1>
              <div class="aside">
                  <span>类型:{{item.typeName}}</span>
                  <span>作者:{{item.bookAuthor}}</span>
                  <span>价格:{{item.bookPrice}}</span>
                  <span>出版时间:{{item.bookPub}}</span>
              </div>
              <div class="content">
                <span>简介:{{item.bookBrief}}</span>
              </div>
          </div>
      </div>
  </div>
</template>

<script>
export default {
  //  父子组件之间的通信props在 Vue 中，父子组件的关系可以总结为 props down, events up。父组件通过 props 向下传递数据给子组件，子组件通过 events 给父组件发送消息。
  props:{
    Books:{
      type:Array,
      default:function(){
        return [];
      }
    }
  }
}
</script>

<style scoped>
.books-item {
  border-bottom: 1px solid #ccc;
  overflow: hidden;
  padding: 20px 0;
}
.image {
  width: 150px;
  height: 150px;
  border: 1px solid #ccc;
  border-radius: 4px;
  float: left;
  margin-right: 20px;
}
.image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.title {
  font-size: 1.5em;
}
.aside {
  font-size: 14px;
  color: #888;
}
.aside span {
  margin-right: 15px;
}

.content {
  max-height: 100px;
  overflow: hidden;
  line-height: 2;
}
</style>